﻿namespace Community.CsharpSqlite.Entity
{
    /*
    ** A RowSet in an instance of the following structure.
    **
    ** A typedef of this structure if found in sqliteInt.h.
    */

    public class RowSet
    {
        public sqlite3 db; /* The database connection */
        public byte iBatch; /* Current insert batch */
        public bool isSorted; /* True if pEntry is sorted */
        public int nFresh; /* Number of objects on pFresh */
        public RowSetChunk pChunk; /* List of all chunk allocations */
        public RowSetEntry pEntry; /* /* List of entries using pRight */
        public RowSetEntry[] pFresh; /* Source of new entry objects */
        public RowSetEntry pLast; /* Last entry on the pEntry list */
        public RowSetEntry pTree; /* Binary tree of entries */

        public RowSet(sqlite3 db, int N)
        {
            pChunk = null;
            this.db = db;
            pEntry = null;
            pLast = null;
            pFresh = new RowSetEntry[N];
            pTree = null;
            nFresh = N;
            isSorted = true;
            iBatch = 0;
        }
    };
}